<template>
  <div class="main">
    <div class="uc-header">
      <div class="back" @click="$router.back()">
        <img src="@/assets/img/3.png" />
      </div>
      <div class="title">{{ $t("Trade1") }}</div>
    </div>
    <div class="infos">
      <div class="item">
        <div class="left">{{ $t("Uid") }}:</div>
        <div class="right">{{ select_INT_TY_DATA.uid }}</div>
      </div>
      <div class="item">
        <div class="left">{{ $t("OrderID") }}：</div>
        <div class="right">{{ select_INT_TY_DATA.order_id }}</div>
      </div>
      <div class="item">
        <div class="left">{{ $t("Quantity") }}：</div>
        <div class="right">{{ select_INT_TY_DATA.usdt_amount }}USDT</div>
      </div>
      <div class="item">
        <div class="left">{{ $t("NetworkType") }}：</div>
        <div class="right">
          <div class="selectbox">
            <div @click="select_show = true">{{ nType }}</div>
            <div class="boxsin" v-show="select_show">
              <div class="boxsin-item" @click.self="changeType('e')">
                {{ $t("USDT_ERC20") }}
              </div>
              <div class="boxsin-item" @click.self="changeType('r')">
                {{ $t("USDT_TRC20") }}
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="tips">
        <div>* {{ $t("tradeTip1") }}</div>
        <div>* {{ $t("tradeTip2") }}</div>
      </div>
    </div>
    <div class="qrcode">
      <div class="error-tips">
        {{ $t("SendOnly") }} {{ nType }} {{ $t("tradeTip3") }}
      </div>
      <div class="qbc">
        <div class="title">{{ $t("tradeTip4") }}</div>
        <div class="qrBox">
          <img :src="select_INT_TY_DATA.qr_code" alt="" />
        </div>
        <div class="info">
          <div class="title2">{{ $t("NetworkType") }}</div>
          <div class="text">{{ select_INT_TY_DATA.recive_usdt_chain }}</div>
        </div>
        <div class="info">
          <div class="title2">{{ $t("ReceiveAddress") }}</div>
          <div class="text">{{ select_INT_TY_DATA.recive_usdt_address }}</div>
        </div>
      </div>
      <div class="copyBtn" @click="copycc">{{ $t("CopyAddress") }}</div>
    </div>
  </div>
</template>

<script>
import { copyText } from "@/utils/common";
export default {
  name: "trade",
  data() {
    return {
      INT_TY_DATA: {},
      loading: true,
      select_INT_TY_DATA: {},
      nType: "USDT_ERC20",
      select_show: false,

      // Uid: this.$route.query?.uid || '',
      // OrderId: this.$route.query?.order_id || '',
      // address: this.$route.query?.recive_usdt_address || '',
      // type: this.$route.query?.recive_usdt_chain || '',
      // qrCode: this.$route.query?.qr_code || '',
      // usdt_amount:this.$route.query?.usdt_amount || '',
    };
  },
  created() {
    if (this.$route.query.isSelect) {
      this.INT_TY_DATA = JSON.parse(localStorage.getItem("INT_TY_DATA")) || {};
      this.select_INT_TY_DATA = this.INT_TY_DATA.erc20;
    }
  },

  methods: {
    copycc() {
      copyText(this.select_INT_TY_DATA.recive_usdt_address);
      this.$toast({ type: "success", message: "复制成功" });
    },
    changeType(type) {
      if (type == "e") {
        this.select_INT_TY_DATA = this.INT_TY_DATA.erc20;
        this.nType = "USDT_ERC20";
      } else {
        this.select_INT_TY_DATA = this.INT_TY_DATA.trc20;
        this.nType = "USDT_TRC20";
      }
      this.select_show = false;
    },
  },
};
</script>

<style lang="less" scoped>
.main {
  min-height: 100vh;
  background: #f5f5f5;

  .infos {
    background-color: #fff;
    border-radius: 30px;
    padding: 30px;
    width: 682px;
    margin: 40px auto;

    .item {
      display: flex;
      align-items: center;
      margin-bottom: 22px;
      font-size: 26px;
      color: #999;

      .right {
        font-weight: 600;
        color: #000;
        .selectbox {
          position: relative;
          &::before {
            content: "";
            display: block;
            width: 0;
            height: 0;
            border: 10px solid transparent;
            border-top-color: #000;
            position: absolute;
            right: -30px;
            top: 10px;
          }
          .boxsin {
            background: #fff;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            position: absolute;
            left: 0;
            top: 30px;
            padding: 10px;
            border-radius: 10px;

            .boxsin-item {
              text-align: center;
              line-height: 1.7;
              font-weight: normal;
            }
          }
        }
      }
    }

    .tips {
      background: #f6f6f6;
      border-radius: 20px;
      padding: 20px;
      font-size: 20px;
      color: #999;
      line-height: 1.3;

      div {
        &:first-of-type {
          margin-bottom: 20px;
        }
      }
    }
  }

  .qrcode {
    border-radius: 30px;
    width: 682px;
    height: 360px;
    margin: auto;
    // background: url('~@/assets/img/tips.png') center/682px 360px no-repeat;
    // padding-top: 60px;
    .error-tips {
      border-radius: 20px 20px 0 0;
      text-align: center;
      height: 60px;
      line-height: 60px;
      font-size: 12px;
      background: pink;
      color: red;
      padding: 0 20px;
    }
    .qbc {
      width: 100%;
      // height:300px;
      background: #fff;
      padding: 30px;
      border-radius: 0 0 20px 20px;

      .title {
        font-size: 30px;
        text-align: center;
        font-weight: 800;
        color: #999;
      }

      .qrBox {
        margin: 40px auto;
        width: 256px;
        height: 256px;
        img {
          width: 256px;
          height: 256px;
        }
      }

      .info {
        .title2 {
          font-size: 24px;
          font-weight: 500;
          margin-bottom: 20px;
          color: #999;
        }

        .text {
          font-weight: bold;
          font-size: 24px;
          color: #333;
          margin-bottom: 40px;
        }
      }
    }
  }

  .copyBtn {
    width: 330px;
    height: 68px;
    background: #fff;
    border: 1px solid #dcdcdc;
    border-radius: 34px;
    font-size: 30px;
    font-family: PingFang SC;
    font-weight: bold;
    color: #cccccc;
    text-align: center;
    line-height: 68px;
    margin: 100px auto 0;
    user-select: none;
  }
}
</style>
